from .models import UserWorkoutHistory, Exercise

class WorkoutRecommendationService:
    @staticmethod
    def generate_personalized_plan(user, history_data):
        """生成个性化健身计划的服务方法"""
        # 这里可以实现更复杂的推荐算法
        pass

    @staticmethod
    def calculate_user_fitness_level(user_history):
        """计算用户健身水平"""
        if not user_history:
            return 'beginner'

        avg_score = sum([h.performance_score for h in user_history]) / len(user_history)

        if avg_score < 0.4:
            return 'beginner'
        elif avg_score < 0.7:
            return 'intermediate'
        else:
            return 'advanced'


